package com.xxxx.server.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xxxx.server.pojo.Inucleic;
import com.xxxx.server.pojo.Notice;
import com.xxxx.server.mapper.NoticeMapper;
import com.xxxx.server.pojo.RespPageBean;
import com.xxxx.server.service.INoticeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 通知表 服务实现类
 * </p>
 *
 * @author zhoubin
 * @since 2022-06-26
 */
@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements INoticeService {

    @Autowired
    private NoticeMapper noticeMapper;

    @Override
    public RespPageBean getPageNoties(Integer currentPage, Integer size, Notice notice, String[] beginDateScope) {
        //开启分页
        Page<Notice> page = new Page<>(currentPage,size);
        IPage<Notice> noticeByPage = noticeMapper.getPageNoties(page, notice, beginDateScope);
        RespPageBean respPageBean = new RespPageBean(noticeByPage.getTotal(), noticeByPage.getRecords());
        return respPageBean;
    }

}
